package com.zsk.shop.enums;

/**
 * @author L
 * @create 2021/4/1 17:49
 */
public enum EnumDecodeType {
    WECHAT("微信", 1),
    DING("钉钉", 2),
    QQ("QQ", 3),
    APPLE("Apple", 4);

    String name;
    Integer code;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    EnumDecodeType(String name, Integer code) {
        this.name = name;
        this.code = code;
    }

    public static String getNameByCode(Integer code) {
        EnumDecodeType[] enums = EnumDecodeType.values();
        for (int i = 0; i < enums.length; i++) {
            if (enums[i].getCode().equals(code)) {
                return enums[i].getName();
            }
        }
        return "";
    }
}
